Naked objects is an architectural pattern used in software engineering.
Contents |
The naked objects pattern is defined by three principles:
1. All business logic should be encapsulated onto the domain objects. This principle is not unique to naked objects: it is just a strong commitment to encapsulation.
2. The user interface should be a direct representation of the domain objects, with all user actions consisting, explicitly, of creating or retrieving domain objects and/or invoking methods on those objects. This principle is also not unique to naked objects: it is just a specific interpretation of an object-oriented user interface (OOUI).
The original idea in the naked objects pattern arises from the combination of these two, to form the third principle:
3. The user interface should be created 100% automatically from the definition of the domain objects. This may be done using several different technologies, including source code generation; implementations of the naked objects pattern to date have favoured the technology of reflection.
The naked objects pattern was first described formally in Richard Pawson's PhD thesis[1] which includes a thorough investigation of various antecedents and inspirations for the pattern including, for example, the Morphic user interface.
Naked Objects is commonly contrasted with the model-view-controller pattern. However, the published version of Pawson's thesis (see References) contains a foreword by Trygve Reenskaug, who first formulated the model-view-controller pattern, suggesting that naked objects is closer to the original intent of model-view-controller than many of the subsequent interpretations and implementations.
Pawson's thesis claims four benefits for the pattern:
The auto-generated OOUI is potentially suitable for sovereign applications but not for transient applications.
There are now several software frameworks that implement the naked objects pattern:
The Department of Social Protection (DSP) (formerly known as the Department for Social and Family Affairs) in Ireland has built a suite of enterprise applications using the naked objects pattern. As part of its Service Delivery Modernisation (SDM) programme, the DSP designed a new enterprise architecture both to meet its planned new business requirements and to provide greater agility over the longer term. The naked objects pattern forms a key element of the SDM architecture[2]. In November 2002, the DSP went live with a new application to replace its existing system for the administration of child benefit. This is believed to be the first operational application of the naked objects pattern, anywhere. The DSP's experience in building this first application, including the reactions of user to the radical user interface is documented extensively in Pawson's thesis.[1], and more recently in a presentation at QCon London 2011[3].
One of the more striking aspects of the DSP experience was the way that the Naked Objects technique permitted re-use very actively. Once a domain object, such as a Customer, had been defined for one 'application' it could be (has been) readily adapted with the minimum of tweaking and addition for use elsewhere. This suggests that the approach could become a favourite in government circles, where re-use is seen as a powerful technique for breaking down siloed systems. The UK 'Transformational Government' policy is particularly keen to see re-use become a standard requirement of new government systems, both consuming other governmental system components and making new ones available for others to use. This re-use is often seen in terms of services, but objects could be an equally powerful approach.
The DSP's initial 'Naked Object Architecture' was developed by an external contractor[4], but the architecture was subsequently redeveloped around the Naked Objects framework, which now forms the basis for future application development, as confirmed in the request for tenders for a four-year programme of further applications to be built using naked objects[5].
The naked objects pattern has attracted a fair amount of criticism since the first public demonstration of the idea at the OOPSLA 2001 conference under the banner of Intriguing Technologies. This criticism has typically focused on one of three main areas:
None of these criticisms is unique to naked objects, but the fact that naked objects combines all three ideas gives it a higher profile.
The naked objects pattern has relevance to several other disciplines and/or trends, including: